myApp.factory('$serAdmin', function($localStorage, $resource){
    var setSend = function(data, url){
        data = data || {};
        url = admin_url + url;
        return $resource(url)
            .save(data)
            .$promise;
    };
    return{
        /*获得某个管理员信息*/
        get: function(data){
            return setSend(data, 'Worker/getWorker');
        },
        list: function(data){
            return setSend(data, 'Worker/getWorkerList');
        },
        /*修改管理员信息*/
        save: function(data){
            return setSend(data, 'Worker/saveWorker');
        },
        /*增加管理员*/
        add: function(data){
            return setSend(data, 'Worker/addWorker');
        },
        /*删除管理员*/
        del: function(data){
            return setSend(data, 'Worker/delWorker');
        },
        /*获取角色和状态列表*/
        select: function(data){
            return setSend(data, 'Worker/getRoleAndStatus');
        }
    }
});
